<?php
namespace Admin\Controller;
use Think\Controller;
use Common\Controller\BaseController;

class AdminController extends BaseController {

    // 单位类型，及对应审批表的字段名
    public static $spdw = array(
         "廉租房" => array(
             "model" => "lzf",
             "spdw" => array(
                 "民政局社会救助股", "车辆管理所", "公积金管理部",
                 "不动产登记局", "工商局", "党委口和社区", "房产局开发股"
             )
         ),
        "公租房" => array(
            "model" => "gzf",
            "spdw" => array(
                "外来务工人员" => array(
                    "人社局企业保险股",  "人社局机关事业保险股",
                    "工商局", "车辆管理所", "不动产登记局", "房产局开发股"
                ),
                "新就业无房职工" => array(
                    "人社局企业保险股",  "人社局机关事业保险股",
                    "工商局", "车辆管理所", "不动产登记局", "房产局开发股"
                ),
                "农村低保对象" => array(
                    "民政局社会救助股", "工商局", "车辆管理所", "不动产登记局", "房产局开发股"
                ),
                "城镇企改下岗退休家庭" => array(
                    "人社局社保股", "工商局", "车辆管理所", "不动产登记局", "房产局开发股"
                ),
                "农村精准扶贫建档立卡对象" => array(
                    "工商局", "车辆管理所", "不动产登记局", "房产局开发股"
                ),
                "政府引进特殊人才" => array(
                    "工商局", "车辆管理所", "不动产登记局", "房产局开发股"
                )
            )
        ),
        "租赁补贴" => array(
            "model" => "zlbt",
            "spdw" => array(
                "民政局社会救助股", "车辆管理所", "公积金管理部",
                "不动产登记局", "工商局", "党委口和社区", "房产局开发股"
            )
        )
    );

    //保障类型，及对应的数据表名
    public static $lx = array(
        "廉租房" => array("model" => "lzf"),
        "公租房" => array("model" => "gzf"),
        "租赁补贴" => array("model" => "zlbt"),
    );

    protected function _initialize()
    {
        if(!session("username")){
            Header("Location: /home/login");
        }
        //显示调用父类的初始化方法
        parent::_initialize();
    }

    public function fn_GetBlacklistReason(){
        return M("blacklist_reason")->field("name, zxyear")->select();
    }

    public function Render_BlacklistDialog($data){
        $info = array(
            "name" => $data['name'],
            "idno" => $data['idno'],
            "phone" => $data['phone']
        );
        $this->assign("info", $info);
        $this->assign("blacklistReason", $this->fn_GetBlacklistReason());
    }

    public function ok(){
        $this->assign("message", html_entity_decode(I("get.msg")));
        $this->display("public/success");
    }
}